package com.wanshu.sys.controller;

import com.wanshu.common.result.IgnoredResultWrapper;
import com.wanshu.common.result.ResultWrapper;
import com.wanshu.common.util.PageUtils;
import com.wanshu.sys.model.SysUserQueryDTO;
import com.wanshu.sys.service.ISysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 系统用户 前端控制器
 * </p>
 *
 * @author 波哥
 * @since 2024-05-28
 */
@Api(tags = "系统用户", value = "sysUser")
@RestController
@RequestMapping("/sys/sysUser")
public class SysUserController {

    @Autowired
    private ISysUserService sysUserService;

    @ApiOperation(notes = "查询用户信息", value = "查询所有用户")
    @GetMapping("/list")
    public String getAllSysUser(){
        return sysUserService.list().toString();
    }

    @IgnoredResultWrapper
    @ApiOperation(notes = "查询用户信息1", value = "查询所有用户1")
    @GetMapping("/list1")
    public String getAllSysUser1(){
        return sysUserService.list().toString();
    }

    @ApiOperation(notes = "查询用户信息2", value = "查询所有用户2")
    @GetMapping("/list2")
    public ResultWrapper getAllSysUser2(){
        ResultWrapper wrapper = new ResultWrapper();
        wrapper.setCode("200");
        wrapper.setData(sysUserService.list());
        wrapper.setMessage("自定义ResultWrapper");
        return wrapper;
    }

    @ApiOperation(notes = "分页用户信息", value = "查询分页用户")
    @GetMapping("/pageQuery")
    public PageUtils getPageUser(@ApiParam(value = "查询的条件") SysUserQueryDTO queryDTO){
        return sysUserService.getPageUser(queryDTO);
    }

    @ApiOperation(value = "查询系统用户", notes = "查询用户")
    @GetMapping("/search")
    public PageUtils list(SysUserQueryDTO dto){
        return sysUserService.queryPage(dto);
    }

}
